/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Victor
 */
@Entity
@Table(name = "clientes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Clientes.findAll", query = "SELECT c FROM Clientes c order by c.nombrerazon"),
    @NamedQuery(name = "Clientes.findById", query = "SELECT c FROM Clientes c WHERE c.id = :id"),
    @NamedQuery(name = "Clientes.findByNombrerazon", query = "SELECT c FROM Clientes c WHERE c.nombrerazon like :nombrerazon order by c.nombrerazon"),
    @NamedQuery(name = "Clientes.findByDato", query = "SELECT c FROM Clientes c WHERE c.nombrerazon like :nombrerazon or c.cuit like :cuit order by c.nombrerazon"),
    @NamedQuery(name = "Clientes.findByCuit", query = "SELECT c FROM Clientes c WHERE c.cuit = :cuit"),
    @NamedQuery(name = "Clientes.findByIngbrutos", query = "SELECT c FROM Clientes c WHERE c.ingbrutos = :ingbrutos"),
    @NamedQuery(name = "Clientes.findByDireccion", query = "SELECT c FROM Clientes c WHERE c.direccion = :direccion"),
    @NamedQuery(name = "Clientes.findByLocalidad", query = "SELECT c FROM Clientes c WHERE c.localidad = :localidad"),
    @NamedQuery(name = "Clientes.findByTelefono", query = "SELECT c FROM Clientes c WHERE c.telefono = :telefono"),
    @NamedQuery(name = "Clientes.findByWeb", query = "SELECT c FROM Clientes c WHERE c.web = :web"),
    @NamedQuery(name = "Clientes.findByEmail", query = "SELECT c FROM Clientes c WHERE c.email = :email"),
    @NamedQuery(name = "Clientes.findByContacto", query = "SELECT c FROM Clientes c WHERE c.contacto = :contacto"),
    @NamedQuery(name = "Clientes.findByEstado", query = "SELECT c FROM Clientes c WHERE c.estado = :estado"),
    @NamedQuery(name = "Clientes.findBySaldo", query = "SELECT c FROM Clientes c WHERE c.saldo = :saldo")})
public class Clientes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nombrerazon")
    private String nombrerazon;
    @Column(name = "cuit")
    private String cuit;
    @Column(name = "ingbrutos")
    private String ingbrutos;
    @Column(name = "direccion")
    private String direccion;
    @Column(name = "localidad")
    private String localidad;
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "web")
    private String web;
    @Column(name = "email")
    private String email;
    @Column(name = "contacto")
    private String contacto;
    @Column(name = "estado")
    private boolean estado;
    @Basic(optional = false)
    @Column(name = "saldo")
    private double saldo;
    @Lob
    @Column(name = "observaciones")
    private String observaciones;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idClientes")
    private List<ClientesContactos> clientesContactosList;
    @JoinColumn(name = "id_tiposiva", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TiposIva idTiposiva;
    @JoinColumn(name = "id_provincias", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Provincias idProvincias;
    

    public Clientes() {
    }

    public Clientes(Integer id) {
        this.id = id;
    }

    public Clientes(Integer id, String nombrerazon, double saldo) {
        this.id = id;
        this.nombrerazon = nombrerazon;
        this.saldo = saldo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombrerazon() {
        return nombrerazon;
    }

    public void setNombrerazon(String nombrerazon) {
        this.nombrerazon = nombrerazon;
    }

    public String getCuit() {
        return cuit;
    }

    public void setCuit(String cuit) {
        this.cuit = cuit;
    }

    public String getIngbrutos() {
        return ingbrutos;
    }

    public void setIngbrutos(String ingbrutos) {
        this.ingbrutos = ingbrutos;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getLocalidad() {
        return localidad;
    }

    public void setLocalidad(String localidad) {
        this.localidad = localidad;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getWeb() {
        return web;
    }

    public void setWeb(String web) {
        this.web = web;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getContacto() {
        return contacto;
    }

    public void setContacto(String contacto) {
        this.contacto = contacto;
    }

    public boolean isEstado() {
        return estado;
    }

    public void setEstado(boolean estado) {
        this.estado = estado;
    }

    

    public double getSaldo() {
        return saldo;
    }

    public void setSaldo(double saldo) {
        this.saldo = saldo;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    @XmlTransient
    public List<ClientesContactos> getClientesContactosList() {
        return clientesContactosList;
    }

    public void setClientesContactosList(List<ClientesContactos> clientesContactosList) {
        this.clientesContactosList = clientesContactosList;
    }

    public TiposIva getIdTiposiva() {
        return idTiposiva;
    }

    public void setIdTiposiva(TiposIva idTiposiva) {
        this.idTiposiva = idTiposiva;
    }

    public Provincias getIdProvincias() {
        return idProvincias;
    }

    public void setIdProvincias(Provincias idProvincias) {
        this.idProvincias = idProvincias;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Clientes)) {
            return false;
        }
        Clientes other = (Clientes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Clientes[ id=" + id + " ]";
    }
    
}
